package com.itheima.project_cloth.mapper;

import com.itheima.project_cloth.pojo.OrderConsumer;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrderConsumerMapper {


    List<OrderConsumer> SelectOrderConsumerByTime(LocalDateTime time,String phoneNumber, String address, String price);

    @Insert("insert into tb_order_consumer (name, begin_time, finish_time, phone_number, address, price, method, consumer_id, cloth_num)" +
            " values (#{name},#{beginTime},#{finishTime},#{phoneNumber},#{address},#{price},#{method},#{consumerId}, #{clothNum})")
    void InsertOrderConsumer(OrderConsumer orderConsumer);



    void DeleteOrderConsumerById(List<Integer> id);

    @Select("select id, name, begin_time, finish_time, phone_number, address, price, method, consumer_id from tb_order_consumer where id=#{id}")
    OrderConsumer UpdateOrderConsumerByIdselect(Integer id);


    void UpdateOrderConsumerById();

    @Select("select * from tb_order_consumer where name = #{name}")
    OrderConsumer SelectOrderConsumerByName(String name);


    @Select("select * from tb_order_consumer where consumer_id = #{consumerId} ")
    List<OrderConsumer> list(Integer consumerId);

    @Select("select * from tb_order_consumer where address = #{address}")
    List<OrderConsumer> listAddress(String address);

    @Select("select * from tb_order_consumer where name = #{name}")
    OrderConsumer select(String name);

    void update(OrderConsumer orderConsumer);
}
